package com.javaGather.day1;

import java.util.ArrayList;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {

        ArrayList<Student> students = new ArrayList<>();
        for (int i = 1; i < 6; i++) {
            System.out.println("请输入第" + i + "名同学姓名");
            Scanner scanner = new Scanner(System.in);
            String name = scanner.nextLine();
            System.out.println("请输入第" + i + "名同学年龄");
            int age = scanner.nextInt();
            students.add(new Student(name, age));
            System.out.println("===========================");
        }
        System.out.println("学生信息录入成功");
        for (Student student : students) {
            System.out.println(student);
        }
    }
}
